package com.atguigu.service.impl;

import com.atguigu.entity.product.Brand;
import com.atguigu.mapper.BrandMapper;
import com.atguigu.service.BrandService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BrandServiceImpl implements BrandService {
    @Autowired
    private BrandMapper brandMapper;

    @Override
    public void submit(Brand brand) {
        brandMapper.submit(brand);
    }

    @Override
    public void remove(Long brandId) {
        brandMapper.remove(brandId);
    }

    @Override
    public void update(Brand brand) {
        brandMapper.update(brand);
    }

    @Override
    public PageInfo<Brand> page(Integer current, Integer limit) {
        PageHelper.startPage(current,limit);
        List<Brand> brandList = brandMapper.page();
        PageInfo<Brand> pageInfo = new PageInfo<>(brandList);
        return pageInfo;
    }
}
